<template>
  <div class="box">
    <header>
      <van-nav-bar title="全部订单">
        <template #left>
          <van-icon
            name="arrow-left"
            size="26"
            color="black"
            @click="$router.back()"
          />
        </template>
      </van-nav-bar>
    </header>
    <main>
      <div class="van-hairline--bottom">
        <van-search
          v-model="value"
          shape="round"
          placeholder="请输入搜索关键词"
        />
      </div>
      <div>
        <van-card
         v-for="(item,index) in orderList" :key="index"
          :num="item.num"
          :price="item.originprice"
          :desc="item.city+' '+item.county"
          :title="item.proname"
          :thumb="item.img1"
        >
          <template #footer>
            <van-button size="small" round color="gray" plain>看相似</van-button>
            <van-button size="small" round color="red" plain>再次购买</van-button>
          </template>
        </van-card>
      </div>
      <van-divider>没有更多订单了~</van-divider>
    </main>
  </div>
</template>

<script>
import {orderlist} from "../api/order"
export default {
  data () {
    return {
      orderList:[] ,
      value:"", 
    }
  },
    created () {
        orderlist({userid:localStorage.userid}).then(res=>{
          console.log(res);
          if(res.data.code==200){
            this.orderList = res.data.data
          }
        })
    }
};
</script>

<style scoped>
.box{
  display: flex;
  flex-direction: column;
}
main{
  flex: 1;
  overflow-y: auto;
  background: rgb(239, 239, 239);
  min-height: 5rem;
}
::v-deep .van-card{
    margin: .1rem .06rem;
    border-radius: .1rem;
}
main::-webkit-scrollbar{
  display: none;
}
</style>